#ifndef WIDGET_SETUP_NETWORK_H
#define WIDGET_SETUP_NETWORK_H



#include "players.h"
#include "widget_setup.h"
#include "gui.h"
#include "network.h"



/** @brief Gui class for connecting to the server and setting parameters for network game
*
*   \image html widget_setup_network.jpeg
*/
class network_setup_widget: public setup_widget
{

	Q_OBJECT

public:

	/** @brief Creates part of the gui
	*	@param parent Qt parent
	*	@param flags Qt flags
	*/
	network_setup_widget( QWidget* parent = 0, Qt::WindowFlags flags = 0 );
	//! @brief Sets pointer to setup to 0 because of change status signal
	~network_setup_widget()
	{
		game_gui::get_instance()->g->setup_w = 0;
	};

	/** @brief Sets connection status message
	*	@param s status message
	*/
	void set_status( const string& s );

	/** @brief Shows connection status message
	*	@param s status message
	*/
	void show_status( const string& s );
	

private:

	//! widget layout
	QVBoxLayout* layout;
	//! input field for game server IP address
	QLineEdit* address_i;
	//! input field for game server port
	QLineEdit* port_i;
	//! input field for player's name
	QLineEdit* name_i;
	//! input field for player's type
	QComboBox* type_i;
	//! input field for player's algorithm
	QComboBox* algorithm_i;
	//! set button
	QPushButton* set_b;
	//! set player's algorithm button
	QPushButton* algorithm_b;
	//! connect button
	QPushButton* connect_b;
	//! status label for connection status info
	QLabel* status_l;
	//! load saved objects button - can be pressed when connected to the server
	QPushButton* next_b;
	

private slots:

	//! @brief Qt slot that jumps to buy screen
	void next();
	//! @brief Qt slot that sets players name and type
	void set_player();
	//! @brief Qt slot that sets player's algorithm
	void set_algorithm();
	//! @brief Qt slot that establishes client-server connection
	void connect_server();

};



#endif